package cn.itcast.hotel.controller;

import cn.itcast.hotel.dto.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import cn.itcast.hotel.vo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Author: Zheng
 * Date:   2024/3/22  16:08
 * Package：cn.itcast.hotel.controller
 * Description：
 * Version：1.0
 */
@RestController
@RequestMapping("/hotel")
@Slf4j
public class HotelController {

    @Autowired
    private IHotelService hotelService;

    /**
     * @description： 酒店搜索，分页查询
     * @date：2024/3/22  16:11
     * @return：
     **/
    @PostMapping("/list")
    public PageResult search(@RequestBody RequestParams requestParams) throws IOException {
        log.info("执行搜索分页操作：requestParams={}",requestParams);
        return hotelService.search(requestParams);
    }
}
